//
//  SystemInfo.swift
//  DigitalMuseum
//
//  Created by cheyongzi on 2023/12/14.
//

import UIKit

struct SystemInfo{
    static let ScreenWidth = UIScreen.main.bounds.size.width
    
    static let ScreenHeight = UIScreen.main.bounds.size.height
    
    static let MinScreenWidth = min(ScreenWidth, ScreenHeight)
    
    static let MaxScreenHeight = max(ScreenWidth, ScreenHeight)
    
    static let NavigationHeight: CGFloat = UIApplication.shared.statusBarFrame.height+44
    
    static let BottomSpace: CGFloat = fullScreen ? 34 : 0
    
    static let TabBarHeight: CGFloat = fullScreen ? 83 : 49
    
    static let BundleVersion: String = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String
    
    static let AppBuild: String = Bundle.main.infoDictionary?["CFBundleVersion"] as! String
    
    static var DeviceName: String = UIDevice.current.name
    
    static let DeviceModel: String = UIDevice.current.model
    
    static let SystemVersion: String = UIDevice.current.systemVersion
    
    static var fullScreen: Bool {
        if #available(iOS 11, *) {
            guard let w = UIApplication.shared.delegate?.window, let unwrapedWindow = w else {
                return false
            }
            if unwrapedWindow.safeAreaInsets.left > 0 || unwrapedWindow.safeAreaInsets.bottom > 0 {
                return true
            }
        }
        return false
    }
    
    static let langStr = Locale.current.languageCode!
}
